package day37;

// 数据库连接池

import java.util.Scanner;

// 参考后进行修改
public class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int max = 0;
            int size = 0;
            for (int i = 0; i < n; i++) {
                String id = in.next();
                String op = in.next();
                if(op.equals("connect")) {
                    size++; // 建立连接
                    max = Math.max(size,max); // 这个超级重要，类似于重叠的去重功能
                } else if (op.equals("disconnect")) {
                    size--;
                }
            }
            System.out.println(max);
        }
    }
}


/*
// 部分通过：
import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int count = 1;
            String[] strings = new String[n];
            for (int i = 0; i < n; i++) {
                strings[i] = in.nextLine();
                if(i>0 && strings[i-1].contains("disconnect") && strings[i].contains("connect")) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}*/
